﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinFormsApp1
{
    public partial class GroupForm : Form
    {
        public string GroupName { get; set; }
        public GroupForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.GroupName = this.textBox1.Text;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void GroupForm_Load(object sender, EventArgs e)
        {
            this.textBox1.Text = this.GroupName;
        }

        private void textBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.button1_Click(null, null);
            }
        }
    }
}
